const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_co_content_item', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: false,
      field: 'NAME_'
    },
    mimeType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'MIME_TYPE_'
    },
    taskId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'TASK_ID_'
    },
    procInstId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'PROC_INST_ID_'
    },
    contentStoreId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CONTENT_STORE_ID_'
    },
    contentStoreName: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CONTENT_STORE_NAME_'
    },
    field: {
      type: DataTypes.STRING(400),
      allowNull: true,
      field: 'FIELD_'
    },
    contentAvailable: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      defaultValue: false,
      field: 'CONTENT_AVAILABLE_'
    },
    created: {
      type: DataTypes.DATE(6),
      allowNull: true,
      field: 'CREATED_'
    },
    createdBy: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CREATED_BY_'
    },
    lastModified: {
      type: DataTypes.DATE(6),
      allowNull: true,
      field: 'LAST_MODIFIED_'
    },
    lastModifiedBy: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'LAST_MODIFIED_BY_'
    },
    contentSize: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: 0,
      field: 'CONTENT_SIZE_'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'TENANT_ID_'
    },
    scopeId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_ID_'
    },
    scopeType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_TYPE_'
    }
  }, {
    sequelize,
    tableName: 'act_co_content_item',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
      {
        name: "idx_contitem_taskid",
        using: "BTREE",
        fields: [
          { name: "TASK_ID_" },
        ]
      },
      {
        name: "idx_contitem_procid",
        using: "BTREE",
        fields: [
          { name: "PROC_INST_ID_" },
        ]
      },
      {
        name: "idx_contitem_scope",
        using: "BTREE",
        fields: [
          { name: "SCOPE_ID_" },
          { name: "SCOPE_TYPE_" },
        ]
      },
    ]
  });
};
